package com.vegetable.modules.service.inbound.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vegetable.modules.entity.inbound.PurchaseDeliveryDetail;
import com.vegetable.modules.mapper.inbound.PurchaseDeliveryDetailMapper;
import com.vegetable.modules.service.inbound.IPurchaseDeliveryDetailService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 入库-采购收货商品表 服务实现类
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-09
 */
@Slf4j
@Service
@AllArgsConstructor
public class PurchaseDeliveryDetailServiceImpl extends ServiceImpl<PurchaseDeliveryDetailMapper, PurchaseDeliveryDetail> implements IPurchaseDeliveryDetailService {

    @Override
    public List<PurchaseDeliveryDetail> selectByDeliverId(Long deliverId) {
        QueryWrapper<PurchaseDeliveryDetail> detailQuery = new QueryWrapper();
        detailQuery.eq("producer_purchase_id", deliverId);
        List<PurchaseDeliveryDetail> deliveryDetails = this.getBaseMapper().selectList(detailQuery);
        return deliveryDetails;
    }

    @Override
    public int deleteById(Long detailId) {
        return this.getBaseMapper().deleteById(detailId);
    }
}
